"""
A super simple means of importing a set of files from an egg.
"""

import os

directory = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'static')

def fget(fn):
    return os.path.join(directory, fn)

def fopen(fn):
    return file(fget(fn), 'rb')

def fread(fn):
    f = fopen(fn)
    content = f.read()
    f.close()
    return content


class StaticFiles(object):

    def __init__(self, directory):
        self.dir = directory

    def fget(self, fn):
        return os.path.join(self.dir, fn)

    def fopen(self, fn):
        return file(self.fget(fn), 'rb')

    def fread(self, fn):
        f = fopen(fn)
        content = f.read()
        f.close()
        return content


